package com.hongxun.design.utils.httputil;


import com.hongxun.design.MyApp;
import com.hongxun.design.mytools.MString;
import com.hongxun.design.mytools.MyLog;
import com.hongxun.design.utils.pathutil.ClipPathUtil;

/**
 * Created by zerdoor_pc on 2016/5/19.
 */
public class HttpStringUtil {
    public static final int ERROR = 99;
    public static final int SUCCESSED = 0;
    public static final int SUCCESSED2 = 1111;
    public static final int SUCCESSED3 = 1112;
    public static final int ADDMROE = 100;


    public static String http = "http://";//头

//        public static String IP3 = "www.dlpwsj.com";//外网ip（暂停使用）
//        public static String Port = ":8898";//内外网通用端口
//        public static String OutPort_speech = ":8899";//外网资源端口

//    public static String Port = ":8868";//内外网通用端口

//    public static String IP3 = "221.236.20.56";//外网ip
//    public static String Port = ":11088";//内外网通用端口
//    public static String OutPort_speech = ":8866";//外网资源端口

    public static String IP3 = "192.168.1.228";//内网ip
//    public static String IP3 = "192.168.0.211";//内网ip
    public static String Port = ":7011";//内外网通用端口
    public static String OutPort_speech = ":8888";//外网资源端口

    /**
     * 基站差分*
     */
    private static String ip = "218.6.173.17";
    private static String port = ":9021";
    public static String HttpHead = http + ip + port;//基站数据接口
    /**
     * 差分接口字段
     **/
    public static String BasestationControl = "/baseStationControl";
    public static String GetDifferenceData = "/getDifferenceData";

    //请求
    public static String Head = http + IP3 + Port;//
    public static String HeadSpeech = http + IP3 + OutPort_speech + "/jgzspass";

//    public static String IP = "192.168.1.132";//内网ip
//    public static String Port_speech = ":8088";//内网资源端口
//    public static String LANHeadSpeech = http + IP + Port_speech;


    /**
     * 获取APP基本配置/systemControl/baseConfig*
     */
    public static String BaseConfig = "/baseConfig";

    /**
     * 平台配置/systemControl/sysType*
     */
    public static String SystemControl = "/systemControl";
    public static String SysType = "/sysType";
    /**
     * 注册/oauthControl/regedit*
     */
    public static String OauthControl = "/oauthControl";
    public static String Regedit = "/regedit";
    /**
     * 发送短信验证码/systemControl/sendIdentCode*
     */
    public static String SendIdentCode = "/sendIdentCode";
    /**
     * 登陆/oauthControl/login*
     */
    public static String Login = "/login";
    /**
     * 短信找回密码/oauthControl/smsRetrieve*
     */
    public static String SmsRetrieve = "/smsRetrieve";
    /**
     * 设置密保问题/oauthControl/setSecurityProblem*
     */
    public static String SetSecurityProblem = "/setSecurityProblem";

    /**
     * 获取密保问题/oauthControl/getSecurityProblem*
     */
    public static String GetSecurityProblem = "/getSecurityProblem";
    /**
     * 密保找回密码/oauthControl/securityRetrieve*
     */
    public static String SecurityRetrieve = "/securityRetrieve";
    /**
     * 修改密码/oauthControl/upPsd*
     */
    public static String UpPsd = "/upPsd";
    public static String ReUpPsd = "/reUpPsd";

    /**
     * 获取指定用户id/consumerControl/getConsumerId*
     */
    public static String GetConsumerId = "/getConsumerId";

    /**
     * 获取用户基本信息/consumerControl/consumerInfo*
     */
    public static String ConsumerControl = "/consumerControl";
    public static String ConsumerInfo = "/consumerInfo";
    /**
     * 修改用户基本信息/consumerControl/upConsumerInfo*
     */

    public static String UpConsumerInfo = "/upConsumerInfo";

    /**
     * 创建项目/projectControl/createProject*
     */
    public static String ProjectControl = "/projectControl";
    public static String CreateProject = "/createProject";

    /**
     * 创建项目/projectControl/upProject*
     */

    public static String UpProject = "/upProject";
    /**
     * 上传文件、图片、语音 /systemControl/upload*
     */

    public static String Upload = "/upload";

    /**
     * 首页图片轮播/systemControl/carousel*
     */

    public static String Carousel = "/carousel";

    /**
     * 典设版本/codesetControl/codesetVersion*
     */
    public static String CodesetControl = "/codesetControl";
    public static String CodesetVersion = "/codesetVersion";


    /**
     * 材料与模块型号查询/codesetControl/likeNameMaterial*
     */
    public static String LikeNameCodeMaterial = "/likeNameCodesetMaterial";

    /**
     * (new)自建项目典型组装
     */
    public static String AddCodeSet = "/addcodeset";
    /**
     * (new)速成点设
     */
    public static String addcodesetbyExperence = "/addcodesetbyExperence";

    /**
     * (new)删除典设材料明细材料
     */
    public static String DelMaterial = "/delcodesetMaterial";

    /**
     * (new)上传项目材料
     */
    public static String AadcodesetVersion = "/aadcodesetVersion";

    public static String UPDATESORT = "/uupcodesetVersion";

    /**
     * (new)为项目选择典设
     */
    public static String CopyCodeset = "/copyCodeset";

    /**
     * (new)为项目典设重命名
     */
    public static String ModfyCodesetName = "/modfyCodesetNameById";

    /**
     * (new)删除项目典设
     */
    public static String DelCodeset = "/delCodeset";

    /**
     * (new)收藏项目典设
     */
    public static String CollectionCodeSet = "/collectionCodeset";

    /**
     * (new)修改项目典设材料:数量,类型
     */
    public static String EditModelMaerial = "/changeCodesetMaterialorModle";

    /**
     * (new)修改项目典设材料:数量,类型
     */
    public static String impModelMaerial = "/impcodesetMaterial";

    /**
     * 典设列表/codesetControl/codesetList*
     */

    public static String CodesetList = "/codesetList";

    /**
     * 典设材料列表/codesetControl/codesetMaterial*
     */

    public static String CodesetMaterial = "/codesetMaterial";
    /**
     * 获取材料列表/expCodesetControl/queryExpCodeset*
     */

    public static String QueryExpCodeset = "/queryExpCodeset";

    /**
     * 获取材料列表/materialControl/materialList*
     */
    public static String MaterialControl = "/materialControl";
    public static String MaterialList = "/materialList";
    public static String MaterialListAll = "/materialListAll";
    public static String Materialtype = "/materialType";
    /**
     * 获取模块列表/moduleControl/moduleList*h
     */
    public static String ModuleControl = "/moduleControl";
    public static String ModuleList = "/moduleList";
    /**
     * 个人项目阶段列表/projectControl/projectList*
     */
    public static String ProjectList = "/projectList";

    /**
     * 条件查询个人所有项目/projectControl/searchAllProject*
     */
    public static String SearchAllProject = "/searchAllProject";

    /**
     * 删除项目阶段/projectControl/delProjectStage*
     */
    public static String DelProjectStage = "/delProjectStage";

    /**
     * 查询项目阶段信息/projectControl/projectInfo*
     */
    public static String ProjectInfo = "/projectInfo";

    /**
     * 条件查询个人项目阶段/projectControl/searchProject*
     */
    public static String SearchProject = "/searchProject";

    /**
     * 单位列表/orgUserControl/orgList*
     */
    public static String OrgUserControl = "/orgUserControl";
    public static String OrgList = "/orgList";
    /**
     * 人员列表/orgUserControl/userByTypeList*
     */

    public static String UserByTypeList = "/userByTypeList";

    /**
     * 踏勘点信息设置/explorationControl/addExploration*
     */
    public static String ExplorationControl = "/explorationControl";
    public static String AddExploration = "/addExploration";
    public static String AddBj = "/addBj";

    /**
     * 踏勘点信息设置/stageControl/getNewNum*
     */
    public static String StageControl = "/stageControl";
    public static String GetNewNum = "/getNewNum";


    /**
     * 踏勘点信息继续设置/explorationControl/conAddExploration*
     */

    public static String ConAddExploration = "/conAddExploration";


    /**
     * 删除踏勘点/explorationControl/delExplor*
     */
    public static String DelExplor = "/delExplor";
    /**
     * 获取踏勘点信息/explorationControl/explorInfo*
     */
    public static String ExplorInfo = "/explorInfo";

    /**
     * 获取踏勘点列表/explorationControl/explorationList*
     */
    public static String ExplorationList = "/explorationList";
    /**
     * 获取上联踏勘点/projectControl/getLastExp?stage_id=5763&classify=1*
     */
    public static String GetLastExp = "/getLastExp";

    /**
     * 修改踏勘点信息/explorationControl/upExploration*
     */
    public static String UpExploration = "/upExploration";
    /**
     * 获取导线类型列表/codesetControl/wireList*
     */
    public static String WireList = "/wireList";

    /**
     * 查询踏勘照片/expPhotoControl/expPhotoList*
     */
    public static String ExpPhotoControl = "/expPhotoControl";

    public static String ExpPhotoList = "/expPhotoList";
    /**
     * 保存踏勘照片/expPhotoControl/saveExpPhoto*
     */

    public static String SaveExpPhoto = "/saveExpPhoto";

    /**
     * 删除踏勘照片/expPhotoControl/delExpPhoto*
     */

    public static String DelExpPhoto = "/delExpPhoto";

    /**
     * 获取踏勘环境信息/environmentControl/envInfo*
     */

    public static String EnvironmentControl = "/environmentControl";
    public static String EnvInfo = "/envInfo";
    /**
     * 保存踏勘环境信息/environmentControl/saveEnv*
     */

    public static String SaveEnv = "/saveEnv";

    /**
     * 获取定位点上级定位点/explorationControl/beforeExp*
     */
    public static String BeforeExp = "/beforeExp";
    /**
     * 通道特征点(有下级)列表/channelControl/channelAList*
     */
    public static String ChannelControl = "/channelControl";
    public static String ChannelAList = "/channelAList";
    public static String upExpDistance = "/upExpDistance";
    /**
     * 通道特征点（无上级）列表/channelControl/channelList*
     */

    public static String ChannelList = "/channelList";
    /**
     * 关联通道特征信息/channelControl/corrChannelFeature*
     */
    public static String CorrChannelFeature = "/corrChannelFeature";

    /**
     * 新增通道特征信息/channelControl/addChannelFeature*
     */
    public static String AddChannelFeature = "/addChannelFeature";

    /**
     * 查询特征点信息/channelControl/queryChannelFeature*
     */
    public static String QueryChannelFeature = "/queryChannelFeature";
    /**
     * 修改通道特征信息/channelControl/upChannelFeature*
     */
    public static String UpChannelFeature = "/upChannelFeature";
    /**
     * 删除通道特征信息/channelControl/delChannelFeature*
     */
    public static String DelChannelFeature = "/delChannelFeature";

    /**
     * 删除踏勘典设材料/expCodesetControl/delExpMaterial*
     */
    public static String ExpCodesetControl = "/expCodesetControl";
    public static String DelExpMaterial = "/delExpMaterial";

    /**
     * 修改踏勘典设材料数量/expCodesetControl/upExpMaterial     /expCodesetControl/upCodesetMaterial*
     */

    public static String UpExpMaterial = "/upExpMaterial";
    public static String UpCodesetMaterial = "/upCodesetMaterial";


    /**
     * 踏勘典设导入材料/expCodesetControl/impExpMaterial*
     */

    public static String ImpExpMaterial = "/impExpMaterial";
    /**
     * 踏勘典设导入模块/expCodesetControl/impExpModule*
     */

    public static String ImpExpModule = "/impExpModule";

    /**
     * 保存踏勘典设方案/expCodesetControl/saveExpCodeset*
     */
    public static String SaveExpCodeset = "/saveExpCodeset";
    /**
     * 项目阶段点位统计/projectStatisticsControl/pointSum*
     */
    public static String ProjectStatisticsControl = "/projectStatisticsControl";
    public static String PointSum = "/pointSum";

    /**
     * 个人项目进度统计/projectStatisticsControl/scheduleCount*
     */

    public static String ScheduleCount = "/scheduleCount";
    /**
     * 获取台区/projectStatisticsControl/explorSum*
     */
    public static String ExplorSum = "/explorSum";
    /**
     * 获取台区/explorationControl/transformerList*
     */
    public static String TransformerList = "/transformerList";

    /**
     * 获取台区数据/projectStatisticsControl/sectionCorss*
     */
    public static String SectionCorss = "/sectionCorss";

    /**
     * 台区材料统计/projectStatisticsControl/materialSum*
     */
    public static String MaterialSum = "/materialSum";
    /**
     * 获取杆塔明细信息/projectStatisticsControl/poleSum*
     */
    public static String PoleSum = "/poleSum";
    /**
     * 阶段用电户/projectStatisticsControl/userPoint*
     */
    public static String UserPoint = "/userPoint";

    /**
     * 百科分类/encyclopediaControl/category*
     */
    public static String EncyclopediaControl = "/encyclopediaControl";
    public static String Category = "/category";

    /**
     * 百科列表/encyclopediaControl /encyclopediaList*
     */

    public static String EncyclopediaList = "/encyclopediaList";

    /**
     * 百科内容/encyclopediaControl/getEncyclopediaContent*
     */
    public static String GetEncyclopediaContent = "/getEncyclopediaContent";

    /**
     * 百科内容/experienceControl/getExperienceContent*
     */

    public static String GetExperienceContent = "/getExperienceContent";

    /**
     * 百科内容/favoriteControl /collectList*
     */
    public static String collectList = "/collectList";
    /**
     * 获取系统文章内容/systemControl/getSysArticleContent*
     */
    public static String GetSysArticleContent = "/getSysArticleContent";

    /**
     * 收藏百科/favoriteControl/addCollect*
     */
    public static String FavoriteControl = "/favoriteControl";
    public static String AddCollect = "/addCollect";
    public static String DelCollect = "/delCollect";

    /**
     * 收藏百科/checkStatisticsControl/checkProject*
     */
    public static String CheckStatisticsControl = "/checkStatisticsControl";
    public static String CheckProject = "/checkProject";

    /**
     * 项目设计统计阶段/projectStatisticsControl/projectSum*
     */
    public static String ProjectSum = "/projectSum";

    /**
     * 项目按字段统计/projectStatisticsControl/fieldSum*
     */
    public static String FieldSum = "/fieldSum";
    /**
     * 项目日志/projectLogControl/logList*
     */
    public static String ProjectLogControl = "/projectLogControl";
    public static String LogList = "/logList";
    /**
     * 当前项目统计/projectLogControl /todayProSum*
     */

    public static String TodayProSum = "/todayProSum";
    /**
     * 日志填报/projectLogControl/assessedLog*
     */

    public static String AssessedLog = "/assessedLog";


    /**
     * 年统计项目数/footprintControl/stageNumByYear*
     */

    public static String FootprintControl = "/footprintControl";
    public static String StageNumByYear = "/stageNumByYear";
    /**
     * 工作统计/footprintControl/workStatistics*
     */

    public static String WorkStatistics = "/workStatistics";
    /**
     * 统计阶段和文章/footprintControl/stageArticleFoot*
     */

    public static String StageArticleFoot = "/stageArticleFoot";

    /**
     * 我的经验/experienceControl/experienceList*
     */

    public static String ExperienceList = "/experienceList";
    public static String ExperienceControl = "/experienceControl";


    /**
     * 删除经验/experienceControl/delExp*
     */
    public static String DelExp = "/delExp";
    /**
     * 消息/systemControl/sysMessList*
     */

    public static String SysMessList = "/sysMessList";


    /**
     * 转角/explorationControl/expCorner*
     */
    public static String ExpCorner = "/expCorner";
    public static String Exp_obj_up = "/exp_obj_up";

    /**
     * 平台产品购买清单/payControl/buyMenuList*
     */
    public static String PayControl = "/payControl";
    public static String BuyMenuList = "/buyMenuList";
    /**
     * 支付/payControl/payment*
     */

    public static String Payment = "/payment";


    /**
     * 材料与模块型号查询/codesetControl/likeNameMaterial*
     */
    public static String LikeNameMaterial = "/likeNameMaterial";
    /**
     * 网络上传/PackageControl/projectPackage*
     */
    public static String PackageControl = "/packageControl";
    public static String ProjectPackage = "/projectPackage";
    public static String OfflineUpload = "/offlineUpload";

    /**
     * 共杆explorationControl/explorationList_high*
     */
    public static String ExplorationList_high = "/explorationList_high";
    /**
     * 验证上传/stageControl/checkStage*
     */
    public static String stageControl = "/stageControl";
    public static String checkStage = "/checkStage";
    /**
     * 获取app基本配置/systemControl/baseConfig*
     */
    static String systemControl = "/systemControl";
    static String sysVersion = "/sysVersion";

    /**
     * （new）随手拍
     */
    public static String photoControl = "/photoControl";


    public static String getUrl(String url) {

        if (url == null || url.equals("")) {
            MyLog.L(MString.URL + "toURLEncoded error:" + url);
            return "";
        }

        try {
            /**转码**/
            //String str = new String(url.getBytes(), "UTF-8");
            //str = URLEncoder.encode(str, "UTF-8");
            //MyLog.L(MString.URL + str);
            return url;
        } catch (Exception localException) {
            MyLog.L(MString.URL + "toURLEncoded error:" + url + localException);
        }

        return url;
    }

    public static String getPath(String url) {
        if (url.contains(MyApp.File.getCachaVoicePath())) {//项目日志中的语音文件
            return url;
        } else if (url.equals("voice.amr") && !MyApp.isOnLine) {
            return MyApp.File.getCachaPhotoVoicePath() + url;
        } else if (!url.contains(HeadSpeech) && !url.contains(ClipPathUtil.getInstance().getVoicePath() + "") && !url.contains(MyApp.File.getCachaPath() + "")) {
            if (url.equals("voice.amr")) {
                return MyApp.File.getCachaPhotoVoicePath() + url;
            } else if (url.indexOf("/") == 0) {
                return HeadSpeech + url;
            } else {
                return HeadSpeech + "/" + url;
            }
        } else if (url.contains("voice.amr") && url.contains(MyApp.File.getCachaPhotoVoicePath())) {
            return url;
        }
        return url;
    }

    //验收
    public static String ProblemControl = "/problemControl";

}
